package com.cwits.wifi;

import android.app.Application;
import android.content.pm.PackageManager;

import com.cwits.wifi.data.beans.FileInfo;
import com.cwits.wifi.util.PreferencesHelper;
import com.tencent.bugly.Bugly;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by ZhangHua on 16-03-01.
 */
public class MainApplication extends Application {
    private final String tag = getClass().getSimpleName();
    private static MainApplication sMyApplication = null;
    private boolean sdcardState = true;
    private Map<String,FileInfo> videoInfoMap = new HashMap<>();
    private int mTimerPicture = 0;
    private boolean errorFlag = false;
    private String mDeviceUUID = null;
    private String mDeviceVersion = null;
    private boolean isModifySSID = false;
    private boolean isModifyPWD = false;
    private String lastModifySSID = null;
    private boolean allowBrowseDev = false;
    private boolean isOffLineMode = true;
    private String appName = null;
    private int appVersion;
    private boolean isFirstReadData = false;
    private boolean isBrowsing = false;
    private boolean isNeedConnect = false;
    private boolean isConnectedBefore = false;
    private boolean isRegisterPengci = false;
    private boolean isExitReal = false;//是否存在后拉摄像头
    private int captureSize;

    @Override
    public void onCreate() {
        super.onCreate();
        Bugly.init(getApplicationContext(), "18a84ff7d0", false);
        sMyApplication = this;
        isNeedConnect = false;

        PackageManager pm = this.getPackageManager();
        appName = getApplicationInfo().loadLabel(pm).toString();
        try {
            appVersion  = pm.getPackageInfo(getPackageName(), 0).versionCode;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
    }

    public static synchronized MainApplication getApplication() {
        return sMyApplication;
    }
    public String getAppName(){
       appName = "理赔保";
        return appName;
    }
    public Map<String, FileInfo> getVideoInfoMap(){
        return videoInfoMap;
    }

    public void setVideoInfoMap(Map<String, FileInfo> infoMap){
        this.videoInfoMap = infoMap;
    }


    public boolean isSdcardState() {
        return sdcardState;
    }

    public void setSdcardState(boolean sdcardState) {
        this.sdcardState = sdcardState;
    }

    public String getLastModifySSID() {
        return lastModifySSID;
    }

    public void setLastModifySSID(String lastModifySSID) {
        this.lastModifySSID = lastModifySSID;
    }

    public void setAllowBrowseDev(boolean bl){
        this.allowBrowseDev = bl;
    }

    public boolean getAllowBrowseDev(){
        return allowBrowseDev;
    }

    public int getTimerPicture() {
        return mTimerPicture;
    }

    public void setTimerPicture(int time) {
        this.mTimerPicture = time;
    }

    public void setErrorFlag(boolean errorFlag){
        this.errorFlag = errorFlag;
    }

    public boolean getErrorFlag(){
        return errorFlag;
    }

    public String getDeviceUUID() {
        return mDeviceUUID;
    }

    public void setDeviceUUID(String uuid) {
        this.mDeviceUUID = uuid;
    }

    public boolean isModifyPWD() {
        return isModifyPWD;
    }

    public void setModifyPWD(boolean isModifyPWD) {
        this.isModifyPWD = isModifyPWD;
    }

    public String getDeviceVersion(){
        return mDeviceVersion;
    }

    public void setDeviceVersion(String version){
        this.mDeviceVersion = version;
    }

    public boolean isModifySSID() {
        return isModifySSID;
    }

    public void setModifySSID(boolean isModifySSID) {
        this.isModifySSID = isModifySSID;
    }
    public void setIsOffLineMode(boolean bl){
        this.isOffLineMode = bl;
    }

    public void setIsNeedReconnect(boolean isNeedReconnect)
    {
        this.isNeedConnect = isNeedReconnect;
    }
    public boolean getIsNeedReconnect()
    {
        return isNeedConnect;
    }

    public boolean getIsOffLineMode(){
        return isOffLineMode;
    }
    public void setIsFirstReadData(boolean bl){
        this.isFirstReadData = bl;
    }

    public boolean getIsFirstReadData(){
        return isFirstReadData;
    }
    public void setIsBrowsing(boolean bl){
        this.isBrowsing = bl;
    }

    public boolean getIsBrowsing(){
        return isBrowsing;
    }

    public boolean getConnectedBefore(){
        return isConnectedBefore;
    }

    public void setConnectedBefore(boolean connectedbefore){
        isConnectedBefore = connectedbefore;
    }

    public void setIsRegisterPengci(boolean registerPengci){
        isRegisterPengci = registerPengci;
    }

    public boolean getIsRegisterPengci(){
        return isRegisterPengci;
    }

    public void setRealCamera(boolean real){
        isExitReal = real;
    }
    public boolean getRealCamera(){
        return isExitReal;
    }

    public void setCaptureSize(int size){
        this.captureSize = size;
    }

    public int getCaptureSize(){
        return captureSize;
    }

    public int getAppVersion() {
        return appVersion;
    }
}
